package com.console.operations.planmgr;

import com.common.test.OperationBase;
import com.common.test.UITestBase;
import com.console.pages.planmgr.FinancePlanReleasePage;

	/**
		@author 王嘉犇
		@name 普通理财计划发布
		@type 动作类
	 */

public class OrdinaryPlanRelease extends OperationBase {

	public OrdinaryPlanRelease(UITestBase tb){
		super(tb);
	}

	public void release(String planname, String amount, String rate, String period, String repaytype, String securitylevel, String activitytype, String investmaxamount, String matchtype, String plantitle, String isfrontdisplay, String summary) throws Exception{
		switchToDefaultContent();
		FinancePlanReleasePage fprp = new FinancePlanReleasePage(tb);
		elementToBeClickable(fprp.plantypeselect);
		waitForElementDisplayed(fprp.plantypeselect);
		fprp.plantypeselect.selectOptionByText("普通理财计划");
		//名称输入框输入理财计划名称
		fprp.nameInput.type(planname);
		pause(600);
		//限额输入框输入金额
		fprp.amountInput.type(amount);
		pause(600);
		//清空年化收益率输入框
		fprp.rateInput.clear();
		pause(100);
		//年化收益率输入框输入年化收益率
		fprp.rateInput.type(rate);
		pause(600);
		//清空理财周期输入框
		fprp.periodInput.clear();
		pause(100);
		//理财周期输入框输入周期
		fprp.periodInput.type(period);
		pause(600);
		//普通计划还款类型选择框选择还款类型
		fprp.paytypeselect.selectOptionByText(repaytype);
		pause(600);
		fprp.securityLevelselect.selectOptionByText(securitylevel);
		pause(600);
		fprp.activityTypeSelect.selectOptionByText(activitytype);
        pause(600);
        fprp.investMaxAmountinput.type(investmaxamount);
        pause(600);
        fprp.matchTypeSelect.selectOptionByText(matchtype);
        pause(600);
        fprp.plantitleinput.type(plantitle);
        pause(600);
        if(isfrontdisplay.equals("是")){
        	fprp.displayradio.click();
        }else if(isfrontdisplay.equals("否")){
        	fprp.notdisplayradio.click();
        }else{
        	throw new Exception("没有这种显示类型");
        }
        pause(600);
        fprp.summaryInput.type(summary);
        pause(600);
		selectFrame("ueditor_0");
		pause(600);
		switchToDefaultContent();
		pause(600);
        fprp.releaseFinancePlanButton.click();
        waitForElementDisplayed(fprp.successp);
        waitForElementNotDisplayed(fprp.successp);
        pause(1500);
	}
}
